package com.bidevalution.business.context;

import com.qtp.core.util.OConvertUtils;

/**
 * @Description 地区
 * @Date        2020-02-13 22:51
 * @Author      lhl
 */
public enum AreaEnum {
    SHIBENJI("01", "市本级"),
    SHANGCHENGQU("02", "上城区"),
    XIACHENGQU("03", "下城区"),
    GONGSHUQU("04", "拱墅区"),
    JIANGGANQU("05", "江干区"),
    XIHUQU("06", "西湖区"),
    BINJIANGQU("11", "滨江区"),
    ZHIJIANGQU("13", "之江区"),
    QIANTANGXINQU("15", "钱塘新区"),
    XIHUFENGJINGQU("14", "西湖风景区"),
    FUYANGQU("16", "富阳区"),
    XIAOSHANQU("17", "萧山区"),
    YUHANGQU("18", "余杭区"),
    LINANQU("19", "临安区"),
    TONGLUXIAN("20", "桐庐县"),
    JIANDESHI("21", "建德市"),
    CHUNANXIAN("22", "淳安县");

    AreaEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static AreaEnum getByCode(String code) {
        if (OConvertUtils.isEmpty(code)){
            return null;
        }
        AreaEnum[] areas = AreaEnum.values();
        for(AreaEnum item : areas) {
            if(code.equals(item.getCode())) {
                return item;
            }
        }
        return null;
    }

    private String code;
    private String name;
}
